import "./index.scss";
import { useNavigate,useLocation } from 'react-router-dom'

const Particulars = () => {
    //取数据
  const state = useLocation();
  console.log("state", state.state);

  //返回上一个页面
    const navigate = useNavigate();
    const back = () => {
        navigate('/home/BusinessLicense')
    }

      //时间转换
  const toDub = (n: any) => (n < 10 ? "0" + n : "" + n);
  //年月日时分秒
  const toTime = (date: any) => {
    const oTime = new Date(date);
    return (
      oTime.getFullYear() +
      "-" +
      toDub(oTime.getMonth() + 1) +
      "-" +
      toDub(oTime.getDate()) +
      " " +
      toDub(oTime.getHours()) +
      ":" +
      toDub(oTime.getMinutes()) +
      ":" +
      toDub(oTime.getSeconds())
    );
  };
  //年月日
  const toDate = (date: any) => {
    const oDate = new Date(date);
    return (
      oDate.getFullYear() +
      "-" +
      toDub(oDate.getMonth() + 1) +
      "-" +
      toDub(oDate.getDate())
    );
  };

    return (
        <div className="student-detail">

            <div className="top">
                <div className="title" onClick={back}>营业执照管理</div>
                <div>&gt;</div>
                <div className="detail">详情</div>
            </div>

            <div className="hr"></div>
            <div className="context-box">
            <img src={state.state.olicense} style={{ width: '200px', height: '300px', border: '1px solid #ccc', display: 'inline-block' }}>
            </img>
                <div className="context">
                    <div className="tr">
                        <div className="td1">备案机构</div>
                        <div className="td2">{state.state.oname}</div>
                    </div>
                    <div className="tr" >
                        <div className="td">办学范围</div>
                        <div>{state.state.orange}</div>
                    </div>
                    <div className="tr">
                        <div className="td">证件类型</div>
                        <div>营业执照</div>
                    </div>
                    <div className="tr">
                        <div className="td">组织代码机构</div>
                        <div>{state.state.ocode}</div>
                    </div>
                    <div className="tr">
                        <div className="td">到期时间</div>
                        <div>{toDate(state.state.oexpire)}</div>
                    </div>
                    <div className="tr">
                        <div className="td">提交时间</div>
                        <div>{toTime(state.state.otime)}</div>
                    </div>
                </div>
            </div>
         
        </div>
    );
};
export default Particulars;
